<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // async 函数返回的是一个promise对象
        // async function fn(){
        //     // return 1;
        //     return Promise.resolve(3)
        // }

        // console.log(fn())

        async function fn1(){
            throw new Error("异常");
            try{
                throw new Error("异常");
            }catch(e){

            }
           
        }

        fn1().then(data =>console.log(data))
        .catch(err => console.log(err));

        console.log(fn1());


// 如果 async函数内部 出现了异常 异常没有在async函数内部被捕获 async函数返回的promise对象状态就是rejected
    </script>
</body>
</html>